package com.qyc.service.impl;

import com.qyc.service.UploadService;
import com.qyc.utils.ResponseResult;
import com.qyc.utils.UploadUtil;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

/**
 * @className: UploadServiceImpl
 * @Description: 文件上传模块
 * @author: qinyc
 * @date: 2023/6/23 19:23
 * @version: v1.0
 */
@Service
public class UploadServiceImpl implements UploadService {

    /**
     * @Author qinyc
     * @Description  文件上传模块
     * @version: v1.0
     * @Date 19:25 2023/6/23
     **/
    @Override
    public ResponseResult upload(MultipartFile file) {
        //调用工具类，完成文件上传
        String url = UploadUtil.upload(file);
        //返回成功响应信息，并将url封装在data中
        return ResponseResult.success(url);
    }
}
